<?php

class Administrator_Model_Register extends Zend_Db_Table_Abstract
{
	protected $_name = "ifunsoft_masterkey_reg";
	protected $_primary = "id";
	protected $db;
	var $id, $name, $email, $phone, $model, $userID, $payment, $time, $note, $status;
	public function __construct(){
		$this->db = Zend_Registry::get('db');
	}
	
	public function getMasterkey_reg()
	{
		$query = $this->db->select()
				->from($this->_name)
				->where('status =?', 1)
				->order('id DESC');
		return $this->db->fetchAll($query);
	}
	
	public function getMasterkey_regById()
	{
		$query = $this->db->select()
				->from($this->_name)
				->where('id =?',$this->id);
		return $this->db->fetchRow($query);
	}
	public function updateStatusRegister(){
		$where = array("id =?" => $this->id);
		$data = array("status" => $this->status);
		$this->db->update($this->_name,$data,$where);
	}
}

